﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class RZControl
{
    public static RZControl SP { get; private set; }

    private RZControl()
    {
        
    }

    [RuntimeInitializeOnLoadMethod (RuntimeInitializeLoadType.BeforeSceneLoad)]
    private static void Initialize()
    {
        SP = new RZControl ();
        SP.Init ();
    }

    private void Init()
    {
        SceneManager.activeSceneChanged += _onActiveScene;
    }

    private void _onActiveScene(Scene cur, Scene next)
    {
        var camera = GameObject.FindWithTag ("MainCamera");
        if (!camera.GetComponent<RZ2DRaycaster> ())
            camera.AddComponent<RZ2DRaycaster> ().maxRayIntersections = 32;
    }
}